# -*- coding: utf-8 -*-

# __date:       2021/7/9
# __author:     Yang Chao
# __function:   Palindrome Number

class Solution:

    def isPalindrome(self, x: int) -> bool:
        # 解法一：转化为字符串，然后反转
        if x < 0:
            return False
        af_x = str(x)[::-1]
        af_x = int(af_x)
        return x == af_x

    def isPalindrome(self, x: int) -> bool:
        # 数学计算方法，求出反数，然后比较是否相等
        if x < 0:
            return False
        pr = x
        re = 0
        while x > 0:
            temp = x % 10
            re = re * 10  + temp
            x = x // 10
        return pr == re